home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Technology Seed / August 1998 ADC Seed CD.toast / Mac OS 8.5b2 / allegro-b2-pseudo-SDK / CIncludes / Finder.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-17  |  15.2 KB  |  425 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Finder.h
  3.  
  4.      Contains:    Finder flags and container types.
  5.  
  6.      Version:    Technology:    Mac OS 8.1
  7.                  Release:    Allego Seed, Use with 3.1 Universal Interfaces
  8.  
  9.      Copyright:    © 1990-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __FINDER__
  19. #define __FINDER__
  20.  
  21. #ifndef __MACTYPES__
  22. #include <MacTypes.h>
  23. #endif
  24. #ifndef __QUICKDRAW__
  25. #include <Quickdraw.h>
  26. #endif
  27. #ifndef __EVENTS__
  28. #include <Events.h>
  29. #endif
  30.  
  31.  
  32.  
  33. #if PRAGMA_ONCE
  34. #pragma once
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41. #if PRAGMA_IMPORT
  42. #pragma import on
  43. #endif
  44.  
  45. #if PRAGMA_STRUCT_ALIGN
  46.     #pragma options align=mac68k
  47. #elif PRAGMA_STRUCT_PACKPUSH
  48.     #pragma pack(push, 2)
  49. #elif PRAGMA_STRUCT_PACK
  50.     #pragma pack(2)
  51. #endif
  52.  
  53. /* Creator and type of clipping files */
  54.  
  55. enum {
  56.     kClippingCreator            = FOUR_CHAR_CODE('drag'),
  57.     kClippingPictureType        = FOUR_CHAR_CODE('clpp'),
  58.     kClippingTextType            = FOUR_CHAR_CODE('clpt'),
  59.     kClippingSoundType            = FOUR_CHAR_CODE('clps'),
  60.     kClippingUnknownType        = FOUR_CHAR_CODE('clpu')
  61. };
  62.  
  63.  
  64. /* Creator and type of Internet Location files */
  65.  
  66. enum {
  67.     kInternetLocationCreator    = FOUR_CHAR_CODE('drag'),
  68.     kInternetLocationHTTP        = FOUR_CHAR_CODE('ilht'),
  69.     kInternetLocationFTP        = FOUR_CHAR_CODE('ilft'),
  70.     kInternetLocationFile        = FOUR_CHAR_CODE('ilfi'),
  71.     kInternetLocationMail        = FOUR_CHAR_CODE('ilma'),
  72.     kInternetLocationNNTP        = FOUR_CHAR_CODE('ilnw'),
  73.     kInternetLocationAFP        = FOUR_CHAR_CODE('ilaf'),
  74.     kInternetLocationAppleTalk    = FOUR_CHAR_CODE('ilat'),
  75.     kInternetLocationGeneric    = FOUR_CHAR_CODE('ilge')
  76. };
  77.  
  78.  
  79.  
  80.  
  81. enum {
  82.     kCustomIconResource            = -16455                        /* Custom icon family resource ID */
  83. };
  84.  
  85. /* In order to specify any of the information described in the */
  86. /* CustomBadgeResource data structure you must clear the kExtendedFlagsAreInvalid */
  87. /* and set kExtendedFlagHasCustomBadge of the FXInfo.fdXFlags or DXInfo.frXFlags field, */
  88. /* and add a resource of type kCustomBadgeResourceType and ID kCustomBadgeResourceID to */
  89. /* the file or to the "Icon/n" file for a folder */
  90.  
  91. enum {
  92.     kCustomBadgeResourceType    = FOUR_CHAR_CODE('badg'),
  93.     kCustomBadgeResourceID        = kCustomIconResource,
  94.     kCustomBadgeResourceVersion    = 0
  95. };
  96.  
  97.  
  98. struct CustomBadgeResource {
  99.     SInt16                             version;                    /* This is version kCustomBadgeResourceVersion*/
  100.     SInt16                             customBadgeResourceID;        /* If not 0, the ID of a resource to use on top*/
  101.                                                                 /* of the icon for this file or folder*/
  102.     OSType                             customBadgeType;            /* If not 0, the type and creator of an icon*/
  103.     OSType                             customBadgeCreator;            /* to use on top of the icon*/
  104.     OSType                             windowBadgeType;            /* If not 0, the type and creator of an icon*/
  105.     OSType                             windowBadgeCreator;            /* to display in the header of the window for this */
  106.                                                                 /* file or folder*/
  107.     OSType                             overrideType;                /* If not 0, the type and creator of an icon to*/
  108.     OSType                             overrideCreator;            /* use INSTEAD of the icon for this file or folder*/
  109. };
  110. typedef struct CustomBadgeResource        CustomBadgeResource;
  111. typedef CustomBadgeResource *            CustomBadgeResourcePtr;
  112. typedef CustomBadgeResourcePtr *        CustomBadgeResourceHandle;
  113. /* You can specify routing information for a file by including a 'rout' 0 
  114.     resource in it and setting the kExtendedFlagHasRoutingInfo bit in the extended 
  115.     Finder flags. 
  116.     The 'rout' resource is an array of RoutingResourceEntry. Each entry is considered
  117.     in turn. The first matching entry is used.
  118.     If the creator and fileType match the file being dropped and targetFolder match
  119.     the folder ID of the folder being dropped onto, then the file is rerouted 
  120.     into the specified destination folder.
  121.     The only target folder currently supported is the system folder, 
  122.     kSystemFolderType = 'macs'.
  123. */
  124.  
  125. enum {
  126.     kRoutingResourceType        = FOUR_CHAR_CODE('rout'),
  127.     kRoutingResourceID            = 0
  128. };
  129.  
  130.  
  131. struct RoutingResourceEntry {
  132.     OSType                             creator;                    /* Use '****' or 0 to match any creator */
  133.     OSType                             fileType;                    /* Use '****' or 0 to match any file type */
  134.     OSType                             targetFolder;                /* Folder ID of the folder this file was dropped onto */
  135.     OSType                             destinationFolder;            /* Folder that the source will be routed to */
  136.     OSType                             reserved;                    /* Set to 0 */
  137. };
  138. typedef struct RoutingResourceEntry        RoutingResourceEntry;
  139.  
  140. typedef RoutingResourceEntry *            RoutingResourcePtr;
  141. typedef RoutingResourcePtr *            RoutingResourceHandle;
  142.  
  143. /* Types for special container aliases */
  144.  
  145. enum {
  146.     kContainerFolderAliasType    = FOUR_CHAR_CODE('fdrp'),        /* type for folder aliases */
  147.     kContainerTrashAliasType    = FOUR_CHAR_CODE('trsh'),        /* type for trash folder aliases */
  148.     kContainerHardDiskAliasType    = FOUR_CHAR_CODE('hdsk'),        /* type for hard disk aliases */
  149.     kContainerFloppyAliasType    = FOUR_CHAR_CODE('flpy'),        /* type for floppy aliases */
  150.     kContainerServerAliasType    = FOUR_CHAR_CODE('srvr'),        /* type for server aliases */
  151.     kApplicationAliasType        = FOUR_CHAR_CODE('adrp'),        /* type for application aliases */
  152.     kContainerAliasType            = FOUR_CHAR_CODE('drop'),        /* type for all other containers */
  153.     kDesktopPrinterAliasType    = FOUR_CHAR_CODE('dtpa'),        /* type for Desktop Printer alias */
  154.     kContainerCDROMAliasType    = FOUR_CHAR_CODE('cddr')        /* type for CD-ROM alias */
  155. };
  156.  
  157. /* Types for Special folder aliases */
  158.  
  159. enum {
  160.     kSystemFolderAliasType        = FOUR_CHAR_CODE('fasy'),
  161.     kAppleMenuFolderAliasType    = FOUR_CHAR_CODE('faam'),
  162.     kStartupFolderAliasType        = FOUR_CHAR_CODE('fast'),
  163.     kPrintMonitorDocsFolderAliasType = FOUR_CHAR_CODE('fapn'),
  164.     kPreferencesFolderAliasType    = FOUR_CHAR_CODE('fapf'),
  165.     kControlPanelFolderAliasType = FOUR_CHAR_CODE('fact'),
  166.     kExtensionFolderAliasType    = FOUR_CHAR_CODE('faex')
  167. };
  168.  
  169. /* Types for AppleShare folder aliases */
  170.  
  171. enum {
  172.     kExportedFolderAliasType    = FOUR_CHAR_CODE('faet'),
  173.     kDropFolderAliasType        = FOUR_CHAR_CODE('fadr'),
  174.     kSharedFolderAliasType        = FOUR_CHAR_CODE('fash'),
  175.     kMountedFolderAliasType        = FOUR_CHAR_CODE('famn')
  176. };
  177.  
  178. /* Finder flags (finderFlags, fdFlags and frFlags) */
  179. /* Any flag reserved or not specified should be set to 0. */
  180. /* If a flag applies to a file, but not to a folder, make sure to check */
  181. /* that the item is not a folder by checking ((ParamBlockRec.ioFlAttrib & ioDirMask) == 0) */
  182.  
  183. enum {
  184.     kIsOnDesk                    = 0x0001,                        /* Files and folders */
  185.     kColor                        = 0x000E,                        /* Files and folders */
  186.                                                                 /* bit 0x0020 was kRequireSwitchLaunch, but is now reserved for future use*/
  187.     kIsShared                    = 0x0040,                        /* Files only (Applications only) */
  188.                                                                 /* If clear, the application needs to write to */
  189.                                                                 /* its resource fork, and therefore cannot be */
  190.                                                                 /* shared on a server */
  191.     kHasNoINITs                    = 0x0080,                        /* Files only (Extensions/Control Panels only) */
  192.                                                                 /* This file contains no INIT resource */
  193.     kHasBeenInited                = 0x0100,                        /* Files only */
  194.                                                                 /* Clear if the file contains desktop database */
  195.                                                                 /* resources ('BNDL', 'FREF', 'open', 'kind'...) */
  196.                                                                 /* that have not been added yet. Set only by the Finder */
  197.                                                                 /* bit 0x0200 was the letter bit for AOCE, but is now reserved for future use */
  198.     kHasCustomIcon                = 0x0400,                        /* Files and folders */
  199.     kIsStationery                = 0x0800,                        /* Files only */
  200.     kNameLocked                    = 0x1000,                        /* Files and folders */
  201.     kHasBundle                    = 0x2000,                        /* Files only */
  202.     kIsInvisible                = 0x4000,                        /* Files and folders */
  203.     kIsAlias                    = 0x8000                        /* Files only */
  204. };
  205.  
  206. /* Obsolete. Use names defined above. */
  207.  
  208. enum {
  209.     fOnDesk                        = kIsOnDesk,
  210.     fHasBundle                    = kHasBundle,
  211.     fInvisible                    = kIsInvisible
  212. };
  213.  
  214. /* Obsolete */
  215.  
  216. enum {
  217.     fTrash                        = -3,
  218.     fDesktop                    = -2,
  219.     fDisk                        = 0
  220. };
  221.  
  222. #if OLDROUTINENAMES
  223.  
  224. enum {
  225.     kIsStationary                = kIsStationery
  226. };
  227.  
  228. #endif  /* OLDROUTINENAMES */
  229.  
  230. /* Extended flags (extendedFinderFlags, fdXFlags and frXFlags) */
  231. /* Any flag not specified should be set to 0. */
  232.  
  233. enum {
  234.     kExtendedFlagsAreInvalid    = 0x8000,                        /* If set the other extended flags are ignored */
  235.     kExtendedFlagHasCustomBadge    = 0x0100,                        /* Set if the file or folder has a badge resource */
  236.     kExtendedFlagHasRoutingInfo    = 0x0004                        /* Set if the file contains routing info resource */
  237. };
  238.  
  239.  
  240.  
  241. /* Use this creation date to indicate that a file is temporarily busy */
  242. /* (while it is being downloaded or installed for example) */
  243. /* This will prevent the Finder from attempting to change attributes */
  244. /* of the file until it is fully created. */
  245.  
  246. enum {
  247.     kMagicBusyCreationDate        = 0x4F3AFDB0
  248. };
  249.  
  250.  
  251. /*------------------------------------------------------------------------*/
  252. /*
  253.    The following data structures are binary compatible with FInfo, DInfo,
  254.    FXInfo and DXInfo but represent the Mac OS 8 semantic of the fields.
  255.    Use these data structures preferably to FInfo, etc...
  256. */
  257. /*------------------------------------------------------------------------*/
  258.  
  259.  
  260. struct FileInfo {
  261.     OSType                             fileType;                    /* The type of the file */
  262.     OSType                             fileCreator;                /* The file's creator */
  263.     UInt16                             finderFlags;                /* ex: kHasBundle, kIsInvisible... */
  264.     Point                             location;                    /* File's location in the folder */
  265.                                                                 /* If set to {0, 0}, the Finder will place the item automatically */
  266.     UInt16                             reserved;                    /* (set to 0) */
  267. };
  268. typedef struct FileInfo                    FileInfo;
  269.  
  270. struct FolderInfo {
  271.     Rect                             windowBounds;                /* The position and dimension of the folder's window */
  272.     UInt16                             finderFlags;                /* ex. kIsInvisible, kNameLocked, etc.*/
  273.     Point                             location;                    /* Folder's location in the parent folder */
  274.                                                                 /* If set to {0, 0}, the Finder will place the item automatically */
  275.     UInt16                             reserved;                    /* (set to 0) */
  276. };
  277. typedef struct FolderInfo                FolderInfo;
  278.  
  279. struct ExtendedFileInfo {
  280.     SInt16                             reserved[4];                /* Reserved (set to 0) */
  281.     UInt16                             extendedFinderFlags;        /* Extended flags (custom badge, routing info...) */
  282.     SInt16                             reserved2;                    /* Reserved (set to 0). Comment ID if high-bit is clear */
  283.     SInt32                             putAwayFolderID;            /* Put away folder ID */
  284. };
  285. typedef struct ExtendedFileInfo            ExtendedFileInfo;
  286.  
  287. struct ExtendedFolderInfo {
  288.     Point                             scrollPosition;                /* Scroll position (for icon views) */
  289.     SInt32                             reserved;                    /* Reserved (set to 0) */
  290.     UInt16                             extendedFinderFlags;        /* Extended flags (custom badge, routing info...) */
  291.     SInt16                             reserved2;                    /* Reserved (set to 0). Comment ID if high-bit is clear */
  292.     SInt32                             putAwayFolderID;            /* Put away folder ID */
  293. };
  294. typedef struct ExtendedFolderInfo        ExtendedFolderInfo;
  295. /*------------------------------------------------------------------------*/
  296. /*
  297.    The following data structures are here for compatibility.
  298.    Use the new data structures replacing them if possible (i.e. FileInfo 
  299.    instead of FInfo, etc...)
  300. */
  301. /*------------------------------------------------------------------------*/
  302. /* File info */
  303. /*
  304.      IMPORTANT:
  305.      In MacOS 8, the fdFldr field has become reserved for the Finder.
  306. */
  307.  
  308. struct FInfo {
  309.     OSType                             fdType;                        /* The type of the file */
  310.     OSType                             fdCreator;                    /* The file's creator */
  311.     UInt16                             fdFlags;                    /* Flags ex. kHasBundle, kIsInvisible, etc. */
  312.     Point                             fdLocation;                    /* File's location in folder. */
  313.                                                                 /* If set to {0, 0}, the Finder will place the item automatically */
  314.     SInt16                             fdFldr;                        /* Reserved (set to 0) */
  315. };
  316. typedef struct FInfo                    FInfo;
  317. /* Extended file info */
  318. /*
  319.      IMPORTANT:
  320.      In MacOS 8, the fdIconID and fdComment fields were changed
  321.      to become reserved fields for the Finder.
  322.        The fdScript has become an extended flag.
  323. */
  324.  
  325. struct FXInfo {
  326.     SInt16                             fdIconID;                    /* Reserved (set to 0) */
  327.     SInt16                             fdReserved[3];                /* Reserved (set to 0) */
  328.     SInt8                             fdScript;                    /* Extended flags. Script code if high-bit is set */
  329.     SInt8                             fdXFlags;                    /* Extended flags */
  330.     SInt16                             fdComment;                    /* Reserved (set to 0). Comment ID if high-bit is clear */
  331.     SInt32                             fdPutAway;                    /* Put away folder ID */
  332. };
  333. typedef struct FXInfo                    FXInfo;
  334. /* Folder info */
  335. /*
  336.      IMPORTANT:
  337.      In MacOS 8, the frView field was changed to become reserved 
  338.        field for the Finder.
  339. */
  340.  
  341. struct DInfo {
  342.     Rect                             frRect;                        /* Folder's window bounds */
  343.     UInt16                             frFlags;                    /* Flags ex. kIsInvisible, kNameLocked, etc.*/
  344.     Point                             frLocation;                    /* Folder's location in parent folder */
  345.                                                                 /* If set to {0, 0}, the Finder will place the item automatically */
  346.     SInt16                             frView;                        /* Reserved (set to 0) */
  347. };
  348. typedef struct DInfo                    DInfo;
  349. /* Extended folder info */
  350. /*
  351.      IMPORTANT:
  352.      In MacOS 8, the frOpenChain and frComment fields were changed
  353.      to become reserved fields for the Finder.
  354.        The frScript has become an extended flag.
  355. */
  356.  
  357. struct DXInfo {
  358.     Point                             frScroll;                    /* Scroll position */
  359.     SInt32                             frOpenChain;                /* Reserved (set to 0) */
  360.     SInt8                             frScript;                    /* Extended flags. Script code if high-bit is set */
  361.     SInt8                             frXFlags;                    /* Extended flags */
  362.     SInt16                             frComment;                    /* Reserved (set to 0). Comment ID if high-bit is clear */
  363.     SInt32                             frPutAway;                    /* Put away folder ID */
  364. };
  365. typedef struct DXInfo                    DXInfo;
  366. /* Values of the 'message' parameter to a Control Panel 'cdev' */
  367.  
  368. enum {
  369.     initDev                        = 0,                            /*Time for cdev to initialize itself*/
  370.     hitDev                        = 1,                            /*Hit on one of my items*/
  371.     closeDev                    = 2,                            /*Close yourself*/
  372.     nulDev                        = 3,                            /*Null event*/
  373.     updateDev                    = 4,                            /*Update event*/
  374.     activDev                    = 5,                            /*Activate event*/
  375.     deactivDev                    = 6,                            /*Deactivate event*/
  376.     keyEvtDev                    = 7,                            /*Key down/auto key*/
  377.     macDev                        = 8,                            /*Decide whether or not to show up*/
  378.     undoDev                        = 9,
  379.     cutDev                        = 10,
  380.     copyDev                        = 11,
  381.     pasteDev                    = 12,
  382.     clearDev                    = 13,
  383.     cursorDev                    = 14
  384. };
  385.  
  386.  
  387. /* Special values a Control Panel 'cdev' can return */
  388.  
  389. enum {
  390.     cdevGenErr                    = -1,                            /*General error; gray cdev w/o alert*/
  391.     cdevMemErr                    = 0,                            /*Memory shortfall; alert user please*/
  392.     cdevResErr                    = 1,                            /*Couldn't get a needed resource; alert*/
  393.     cdevUnset                    = 3                                /* cdevValue is initialized to this*/
  394. };
  395.  
  396. /* Control Panel Default Proc */
  397. typedef CALLBACK_API( long , ControlPanelDefProcPtr )(short message, short item, short numItems, short cPanelID, EventRecord *theEvent, long cdevValue, DialogPtr cpDialog);
  398. typedef STACK_UPP_TYPE(ControlPanelDefProcPtr)                     ControlPanelDefUPP;
  399. enum { uppControlPanelDefProcInfo = 0x000FEAB0 };                 /* pascal 4_bytes Func(2_bytes, 2_bytes, 2_bytes, 2_bytes, 4_bytes, 4_bytes, 4_bytes) */
  400. #define NewControlPanelDefProc(userRoutine)                     (ControlPanelDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlPanelDefProcInfo, GetCurrentArchitecture())
  401. #define CallControlPanelDefProc(userRoutine, message, item, numItems, cPanelID, theEvent, cdevValue, cpDialog)  CALL_SEVEN_PARAMETER_UPP((userRoutine), uppControlPanelDefProcInfo, (message), (item), (numItems), (cPanelID), (theEvent), (cdevValue), (cpDialog))
  402.  
  403.  
  404.  
  405. #if PRAGMA_STRUCT_ALIGN
  406.     #pragma options align=reset
  407. #elif PRAGMA_STRUCT_PACKPUSH
  408.     #pragma pack(pop)
  409. #elif PRAGMA_STRUCT_PACK
  410.     #pragma pack()
  411. #endif
  412.  
  413. #ifdef PRAGMA_IMPORT_OFF
  414. #pragma import off
  415. #elif PRAGMA_IMPORT
  416. #pragma import reset
  417. #endif
  418.  
  419. #ifdef __cplusplus
  420. }
  421. #endif
  422.  
  423. #endif /* __FINDER__ */
  424.  
  425.